import React, {Component} from 'react';
import {StyleSheet, View, Text, Switch, Image} from 'react-native';
import {screenWidth} from '../communals/MyExports.js';

/**
 * 设置界面
 * Created by 10691 on 17/5/18.
 */
export default class Settings extends Component {

    constructor() {
        super();
        this.state = {
            isSwitchOn: false,
        }
    }

    render() {
        return (
            <View style={{flex: 1, backgroundColor: 'white'}}>
                <View style={SettingsStyles.lineStyle}>
                    <Text>淘宝天猫快捷下单</Text>
                    <Switch
                        style={SettingsStyles.switchStyle}
                        onValueChange={(value) => {
                            this.setState({isSwitchOn: value})
                        }}
                        value={this.state.isSwitchOn}/>
                </View>

                <View style={SettingsStyles.lineStyle}>
                    <Text>清理图片缓存</Text>
                    <Image source={{uri: 'icon_cell_rightArrow'}} style={SettingsStyles.arrowStyle}/>
                </View>
            </View>
        );
    }
}

const SettingsStyles = StyleSheet.create({
    lineStyle: {
        height: 45,
        flexDirection: 'row',
        width: screenWidth,
        marginLeft: 10,
        borderBottomColor: '#6f6f6f',
        borderBottomWidth: 1,
        justifyContent: 'space-between',
        alignItems: 'center',
    },

    switchStyle: {
        marginRight: 20,
    },

    arrowStyle: {
        width: 10,
        height: 10,
        marginRight: 35,
    },
});